<template>
  <el-card class="card">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-table
      v-loading="isLoading"
      :data="rightList"
      border
      style="width: 100%"
    >
      <el-table-column type="index" width="50" align="center"> </el-table-column>
      <el-table-column prop="authName" label="权限名称" width="200" align="center">
      </el-table-column>
      <el-table-column prop="path" label="路径"> </el-table-column>
      <el-table-column label="层级">
        <template slot-scope="scope">
          <span>{{ scope.row.level | fmtLevel }}</span>
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
import { getRightList } from "../../api/index";

export default {
  name: "",
  data() {
    return {
      rightList: [],
      isloading: false
    };
  },
  watch: {},
  props: {},
  components: {},
  computed: {},
  mounted() {},
  methods: {},
  filters: {
       fmtLevel (level) {
        if (level === '0') {
            return '一级'
        } else if (level === '1') {
            return '二级'
        } else {
            return '三级'
        }
    }
  },

  async created() {
    this.isLoading = true;
    let { data, meta } = await getRightList({ type: "list" });
    if (meta.status === 200) {
        // console.log(data);
      this.rightList = data
      this.isLoading = false
    }
  }
};
</script>

<style scoped lang="css"></style>
